home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / numlock.zip / NUMLOCK.PAS < prev   
Pascal/Delphi Source File  |  1987-04-09  |  1KB  |  56 lines

  1. Program NUMLOCK;
  2.  
  3. {  This short program will allow the NUMLOCK key to be toggled on or off
  4.    from the DOS command level.  To use type:
  5.  
  6.         NUMLOCK ON   - to toggle the numlock key on (keypad numeric)
  7.         NUMLOCK OFF  - to toggle the numlock key off (keypad non-numeric)
  8.  
  9. }
  10.  
  11.  
  12. {  Turbo Pascal routines to toggle the NUMLOCK on or off  }
  13.  
  14. Var  Key_Stat     : byte  absolute $0040:$0017;
  15.      Old_Key_Stat : byte;
  16.      toggle       : string[255];
  17.      i            : integer;
  18.  
  19.  
  20.  
  21. procedure Num_Lock_Off;
  22.  
  23. begin
  24.  
  25.   Key_Stat := Key_Stat and $DF;
  26.  
  27. end;
  28.  
  29. procedure Num_Lock_On;
  30.  
  31. begin
  32.  
  33.   Old_Key_Stat := Key_Stat;
  34.   Key_Stat := Old_Key_Stat or $20;
  35.  
  36. end;
  37.  
  38.  
  39.  
  40. Begin
  41.  
  42.    if paramcount = 0
  43.       then writeln ('Usage:  NUMLOCK   ON|OFF')
  44.       else begin
  45.          toggle := paramstr(1);
  46.          for i := 1 to length(toggle)
  47.             do toggle[i] := upcase(toggle[i]);
  48.          if toggle = 'ON'
  49.             then Num_Lock_On
  50.             else if toggle = 'OFF'
  51.                then Num_Lock_Off
  52.                else writeln ('Usage:  NUMLOCK   ON|OFF');
  53.       end;
  54.  
  55. End.
  56.